<!--
    tHeader: Array,
    filterVal: Array,
    title: String,
    importCallBack:导入的回调函数
    -->

<template>
  <div class="importDataModal-content">
    <rj-modal
      width="800px"
      :title="$t('components.rjImportModal.title')"
      :footer="null"
      :visible="visible"
      :confirm-loading="confirmLoading"
      @cancel="handleCancel"
      :dialog-style="{ top: '20px' }"
    >
      <!-- tHeader -->
      <!-- filterVal -->
      <excel-import
        :tHeader="tHeader"
        :filterVal="filterVal"
        @importCallBack="importCallBack"
      >
        <template>
          <p style="color: red">{{ calltips }}</p>
        </template>
      </excel-import>
    </rj-modal>
  </div>
</template>

<script>
import { RjModal, ExcelImport } from '@components';
import { i18nRender } from '@/locales';

export default {
  name: 'rjimportmodal',
  components: {
    RjModal,
    ExcelImport,
  },
  props: {
    tHeader: Array,
    filterVal: Array,
    title: String,
    tips: {
      typeof: String,
      default: i18nRender('components.rjImportModal.defaluttip'),
    },
  },
  data() {
    return {
      visible: false,
      confirmLoading: false,
    };
  },
  methods: {
    handleCancel() {
      this.visible = false;
    },
    showModal() {
      this.visible = true; //显示
    },
    async importCallBack(list) {
      this.$emit('importCallBack', list);
    },
  },

  created() {},
  mounted() {},
  computed: {
    calltips() {
      if (this.tips == this.$t('components.rjImportModal.defaluttip')) {
        return this.$t('components.rjImportModal.defaluttip');
      } else {
        return this.tips;
      }
    },
  },
};
</script>
<style lang="less" scoped></style>
